/*
 * ArrayOrdened.hpp
 *
 *  Created on: 23/07/2012
 *      Author: marcio
 */

#ifndef ARRAYORDENED_HPP_
#define ARRAYORDENED_HPP_

template<typename T>
class ArrayOrdened: public Array<T> {
protected:
	int (*order)(T* a, T* b);
public:
	ArrayOrdened();
	virtual ~ArrayOrdened();

	ArrayOrdened(int size);

	ArrayOrdened(List<T>* a, int (*order)(T* a, T* b));

	ArrayOrdened(Array<T>* a, int (*order)(T* a, T* b));

	T getElem(long i);

	bool setElem(long i, T newElem);

	bool putElem(T newElem);

	bool order(int (*function)(T, T));

	bool isEmpty();

	int searchFor(T elem, int (*isEqual)(T, T));

	int sort(int (*comp)(T,T));

	virtual ~Array();

	T operator[](long i){ return getElem(i);}

	int operator+(T elem){return putElem(elem);}
};

#endif /* ARRAYORDENED_HPP_ */
